import request from '@/utils/request'

// 获得学生列表 /teachers/getTeachers
/* 
  @ param  any
     作为需要向后端传递的参数
     注意 get param
         post  body
*/
let getTeachers = async (params) => {
    let result = await request({
        method: 'GET',
        url: '/teachers/getTeachers',
        params: {
            ...params,
            role: "teachers"
        }
    })
    return result
}

// 带审核学生列表 /teachers/getUnOpenTeacher
let getUnOpenTeacher = async (params) => {
    let result = await request({
        method: 'GET',
        url: '/teachers/getUnOpenTeacher',
        params: {
            ...params,
            role: "teachers"
        }
    })
    return result
}


// 通过学号删除学员 /teachers/delTeacher

let delTeacher = async (params) => {
    let result = await request({
        method: 'post',
        url: '/teachers/delTeacher',
        data: {
            ...params,
            role: "teachers"
        }
    })
    return result
}

// 修改学生信息 /teachers/updateTeacher
let updateTeacher = async (params) => {
    console.log(params);
    let result = await request({
        method: 'post',
        url: '/teachers/updateTeacher',
        data: {
            ...params,
            role: "teachers"
        }
    })
    return result
}

// 学生新增 /teachers/addTeacher
let addTeacher = async (params) => {
    let result = await request({
        method: 'post',
        url: '/teachers/addTeacher',
        data: {
            ...params,
            role: "teachers"
        }
    })
    return result
}

export default {
    getTeachers,
    delTeacher,
    updateTeacher,
    addTeacher,
    getUnOpenTeacher
}